package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 商品详情表
 * </p>
 *
 * @author cnswhy
 * @since 2020-11-22
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_shop_product")
@ApiModel(value = "ShopProduct", description = "商品详情表")
@AllArgsConstructor
public class ShopProduct extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 商户id
     */
    @ApiModelProperty(value = "商户id")
    @NotNull(message = "商户id不能为空")
    @TableField("merchant_id")
    @Excel(name = "商户id")
    private Long merchantId;

    /**
     * 二级分类id
     */
    @ApiModelProperty(value = "二级分类id")
    @NotNull(message = "二级分类id不能为空")
    @TableField("classify_id")
    @Excel(name = "二级分类id")
    private Long classifyId;

    /**
     * 品牌id
     */
    @ApiModelProperty(value = "品牌id")
    @NotNull(message = "品牌id不能为空")
    @TableField("brand_id")
    @Excel(name = "品牌id")
    private Long brandId;

    /**
     * 商品名称
     */
    @ApiModelProperty(value = "商品名称")
    @NotEmpty(message = "商品名称不能为空")
    @Length(max = 255, message = "商品名称长度不能超过255")
    @TableField(value = "product_name", condition = LIKE)
    @Excel(name = "商品名称")
    private String productName;

    /**
     * 商品描述，用户分享
     */
    @ApiModelProperty(value = "商品描述，用户分享")
    @Length(max = 255, message = "商品描述，用户分享长度不能超过255")
    @TableField(value = "product_remark", condition = LIKE)
    @Excel(name = "商品描述，用户分享")
    private String productRemark;

    /**
     * 缩略图
     */
    @ApiModelProperty(value = "缩略图")
    @NotEmpty(message = "缩略图不能为空")
    @Length(max = 255, message = "缩略图长度不能超过255")
    @TableField(value = "thumbnail_img", condition = LIKE)
    @Excel(name = "缩略图")
    private String thumbnailImg;

    /**
     * 1普通商品2虚拟商品
     */
    @ApiModelProperty(value = "1普通商品2虚拟商品")
    @NotNull(message = "1普通商品2虚拟商品不能为空")
    @TableField("product_type")
    @Excel(name = "1普通商品2虚拟商品")
    private Integer productType;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @TableField("sort_order")
    @Excel(name = "排序")
    private Integer sortOrder;

    /**
     * 轮播图列表
     */
    @ApiModelProperty(value = "轮播图列表")
    @Length(max = 1000, message = "轮播图列表长度不能超过1000")
    @TableField(value = "slider_imgs", condition = LIKE)
    @Excel(name = "轮播图列表")
    private String sliderImgs;

    /**
     * 商品海报
     */
    @ApiModelProperty(value = "商品海报")
    @Length(max = 255, message = "商品海报长度不能超过255")
    @TableField(value = "poster_img", condition = LIKE)
    @Excel(name = "商品海报")
    private String posterImg;

    /**
     * 1销售中2下架3删除4待审核5保存6审核不通过
     */
    @ApiModelProperty(value = "1销售中2下架3删除4待审核5保存6审核不通过")
    @TableField("status")
    @Excel(name = "1销售中2下架3删除4待审核5保存6审核不通过")
    private Integer status;

    /**
     * 商品介绍
     */
    @ApiModelProperty(value = "商品介绍")
    @Length(max = 65535, message = "商品介绍长度不能超过65535")
    @TableField("product_desc")
    @Excel(name = "商品介绍")
    private String productDesc;

    /**
     * 产品参数
     */
    @ApiModelProperty(value = "产品参数")
    @Length(max = 65535, message = "产品参数长度不能超过65535")
    @TableField("product_parameter")
    @Excel(name = "产品参数")
    private String productParameter;

    /**
     * 拒绝原因
     */
    @ApiModelProperty(value = "拒绝原因")
    @Length(max = 255, message = "拒绝原因长度不能超过255")
    @TableField(value = "refused_remark", condition = LIKE)
    @Excel(name = "拒绝原因")
    private String refusedRemark;

    /**
     * 违规下架原因
     */
    @ApiModelProperty(value = "违规下架原因")
    @Length(max = 255, message = "违规下架原因长度不能超过255")
    @TableField(value = "violation_stop_remark", condition = LIKE)
    @Excel(name = "违规下架原因")
    private String violationStopRemark;

    /**
     * 创建日期
     */
    @ApiModelProperty(value = "创建日期")
    @TableField("create_date")
    @Excel(name = "创建日期", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime createDate;

    /**
     * 违规下架日期
     */
    @ApiModelProperty(value = "违规下架日期")
    @TableField("violation_stop_date")
    @Excel(name = "违规下架日期", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime violationStopDate;

    /**
     * 一级分类id
     */
    @ApiModelProperty(value = "一级分类id")
    @NotNull(message = "一级分类id不能为空")
    @TableField("classify_parent_id")
    @Excel(name = "一级分类id")
    private Long classifyParentId;

    /**
     * 运费类型 1-固定运费 2-使用运费模板
     */
    @ApiModelProperty(value = "运费类型 1-固定运费 2-使用运费模板")
    @TableField("freight_type")
    @Excel(name = "运费类型 1-固定运费 2-使用运费模板")
    private Integer freightType;

    /**
     * 运费金额
     */
    @ApiModelProperty(value = "运费金额")
    @TableField("freight_price")
    @Excel(name = "运费金额")
    private BigDecimal freightPrice;

    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    @Length(max = 20, message = "创建人长度不能超过20")
    @TableField(value = "creator", condition = LIKE)
    @Excel(name = "创建人")
    private String creator;

    @ApiModelProperty(value = "")
    @TableField("sell_num")
    @Excel(name = "")
    private Integer sellNum;

    /**
     * 关联分润ID
     */
    @ApiModelProperty(value = "关联分润ID")
    @TableField("price_id")
    @Excel(name = "关联分润ID")
    private Long priceId;

    /**
     * 拼购区1是2否
     */
    @ApiModelProperty(value = "拼购区1是2否")
    @TableField("spell_area")
    @Excel(name = "拼购区1是2否")
    private Integer spellArea;

    /**
     * 拼团人数
     */
    @ApiModelProperty(value = "拼团人数")
    @TableField("spell_people")
    @Excel(name = "拼团人数")
    private Integer spellPeople;

    @ApiModelProperty(value = "")
    @Length(max = 255, message = "长度不能超过255")
    @TableField(value = "url", condition = LIKE)
    @Excel(name = "")
    private String url;

    @ApiModelProperty(value = "")
    @Length(max = 255, message = "长度不能超过255")
    @TableField(value = "poster_url", condition = LIKE)
    @Excel(name = "")
    private String posterUrl;

    @ApiModelProperty(value = "")
    @Length(max = 1000, message = "长度不能超过1000")
    @TableField(value = "slider_urls", condition = LIKE)
    @Excel(name = "")
    private String sliderUrls;

    /**
     * 拼购券商品 0 否 1 是
     */
    @ApiModelProperty(value = "拼购券商品 0 否 1 是")
    @TableField("spell_product")
    @Excel(name = "拼购券商品",replace = {"是_1","否_0"})
    private Integer spellProduct;
    /**
     * 是否共享设备 0 否 1 是
     */
    @ApiModelProperty(value = "是否共享设备 0 否 1 是")
    @TableField("is_iot_terminal")
    @Excel(name = "是否共享设备",replace = {"是_1","否_0"})
    private Integer isIotTerminal;

    @Builder
    public ShopProduct(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long createUser, Long updateUser, 
                    Long merchantId, Long classifyId, Long brandId, String productName, String productRemark, 
                    String thumbnailImg, Integer productType, Integer sortOrder, String sliderImgs, String posterImg, Integer status, 
                    String productDesc, String productParameter, String refusedRemark, String violationStopRemark, LocalDateTime createDate, LocalDateTime violationStopDate, 
                    Long classifyParentId, Integer freightType, BigDecimal freightPrice, String creator, Integer sellNum, Long priceId, 
                    Integer spellArea, Integer spellPeople, String url, String posterUrl, String sliderUrls, Integer spellProduct, Integer isIotTerminal) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.createUser = createUser;
        this.updateUser = updateUser;
        this.merchantId = merchantId;
        this.classifyId = classifyId;
        this.brandId = brandId;
        this.productName = productName;
        this.productRemark = productRemark;
        this.thumbnailImg = thumbnailImg;
        this.productType = productType;
        this.sortOrder = sortOrder;
        this.sliderImgs = sliderImgs;
        this.posterImg = posterImg;
        this.status = status;
        this.productDesc = productDesc;
        this.productParameter = productParameter;
        this.refusedRemark = refusedRemark;
        this.violationStopRemark = violationStopRemark;
        this.createDate = createDate;
        this.violationStopDate = violationStopDate;
        this.classifyParentId = classifyParentId;
        this.freightType = freightType;
        this.freightPrice = freightPrice;
        this.creator = creator;
        this.sellNum = sellNum;
        this.priceId = priceId;
        this.spellArea = spellArea;
        this.spellPeople = spellPeople;
        this.url = url;
        this.posterUrl = posterUrl;
        this.sliderUrls = sliderUrls;
        this.spellProduct = spellProduct;
        this.isIotTerminal = isIotTerminal;
    }

}
